package com.rexense.beacon.controller;

import com.rexense.beacon.entity.Label;
import com.rexense.beacon.service.LabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Comparator;
import java.util.List;

@RestController
@RequestMapping("/label")
public class LabelController {

    @Autowired
    private LabelService labelService;

    @CrossOrigin(origins = "*", maxAge = 3600)
    @RequestMapping("/list")
    public Object list(@RequestParam String labelId) {
        return labelService.listLabelLocation(labelId);
    }


    @CrossOrigin(origins = "*", maxAge = 3600)
    @RequestMapping("/get")
    public Object get(@RequestParam String labelId) {
        return labelService.getLabelById(labelId);
    }
}
